//////////////////////////////////////////////////////////////////////////////////////////////////////////// // // //---------------------------- Ebrahim Foulaadvand, 31 July 2013 ----------------- // // // // The routine "GaussSeidel" solves the 2D Laplace equation using Gauss-Seidel relaxation method. // // Dirichlet boundary condition is used. The region is a rectangle of side lengths Lx and Ly. // // // // // // // // //////////////////////////////////////////////////////////////////////////////////////////////////////////// #include #include #include #include #include #include #include #include #include #include using namespace std; main() { const Nxsize=100,Nysize=200; int i,j,n,Nx=100,Ny=200,T=15000; double Lx=1,Ly=2,a1=0.,a2=0.,a3=1.,a4=0.,delx,dely; double Phi[Nxsize+1][Nysize+1],Phinew[Nxsize+1][Nysize+1]; // 2D arrays "Phi" and "Phinew" store the current and updated values of potential at grid points. ofstream file1 ("X profile y=0.1Ly n=11000.plt"); // output file for the potential profile at timestep n=10. ofstream file2 ("X profile y=0.1Ly n=12000.plt"); // output file for the potential profile at timestep n=50. ofstream file3 ("X profile y=0.1Ly n=13000.plt"); // output file for the potential profile at timestep n=50. ofstream file4 ("X profile y=0.1Ly n=15000.plt"); // output file for the potential profile at timestep n=50. delx=Lx/Nx; cout<<"delx= "<